//
//  QShowSubAlertView.m
//  QoilPublic
//
//  Created by 杨凯 on 16/11/23.
//  Copyright © 2016年 杨凯. All rights reserved.
//

#import "QShowSubAlertView.h"

@interface QShowSubAlertView()


@property (weak, nonatomic) IBOutlet UIImageView *headImg;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@property (weak, nonatomic) IBOutlet UIButton *agreeBtn;

@property (weak, nonatomic) IBOutlet UIView *bacView;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bottomConstr;


@end
@implementation QShowSubAlertView

- (void)awakeFromNib{
    [super awakeFromNib];
    self.bacView.layer.cornerRadius = 4.0;
}

- (void)setImg:(UIImage *)img{
    _img = img;
    _headImg.image = img;
}

- (void)setContent:(NSString *)content{
    _content = content;
    if(_type == 2){
        _bottomConstr.constant = 5;
        _contentLabel.font = [UIFont systemFontOfSize:16];
    }else{
        _bottomConstr.constant = 25;
        _contentLabel.font = [UIFont systemFontOfSize:18];
    }
    _contentLabel.text = _content;
}

- (void)setBtnTitle:(NSString *)btnTitle{
    _btnTitle = btnTitle;
    [_agreeBtn setTitle:_btnTitle forState:UIControlStateNormal];
}

- (void)setType:(NSInteger)type{
    _type = type;
    if(_type == 1){
        _titleLabel.hidden = YES;
    }else{
        _titleLabel.hidden = NO;
    }
}

- (IBAction)agreeAction:(id)sender {
    if(self.block){
        self.block();
    }
}


@end
